package cn.tedu.tmall.admin.mall.schedule;

import cn.tedu.tmall.admin.mall.service.ICategoryService;
import cn.tedu.tmall.admin.mall.service.IOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class OrderSchedule {

    @Autowired
    private IOrderService service;

    // 秒 时 分 日 月 周
    // cron = ""
    // fixedDelay：执行间隔
    // fixedRate：执行频率
    @Scheduled(fixedRate = 5 * 60 * 1000)
    public void rebuildCache() {
        log.info("开始执行所有超时未支付订单");
        service.closeUnpaid();
    }

}
